package com.example.computer_exam_training_sys.service.impl;

import com.example.computer_exam_training_sys.entity.User_Examdetails_Info;
import com.example.computer_exam_training_sys.mapper.User_ExamdetailsMapper;
import com.example.computer_exam_training_sys.service.User_Examdetails_Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class User_ExamdetailsServiceImpl implements User_Examdetails_Service {
    @Autowired
    private User_ExamdetailsMapper examdetailsMapper;

    @Override
    public List<User_Examdetails_Info> getDetailsByExamId(int exam_id) {
        return examdetailsMapper.selectByExamId(exam_id);
    }

    @Override
    public User_Examdetails_Info getDetailById(int detail_id) {
        return examdetailsMapper.selectById(detail_id);
    }

    @Override
    public int addDetail(User_Examdetails_Info detail) {
        return examdetailsMapper.insertDetail(detail);
    }

    @Override
    public User_Examdetails_Info getDetailByExamAndQuestion(int exam_id, int question_id) {
        return examdetailsMapper.selectByExamAndQuestion(exam_id, question_id);
    }
}